﻿@using DataAccess.Helpers

@model DataAccess.Article

@{
    ViewBag.Title = "Edition d'un article";
}

<h2>Edition d'un article</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Article</legend>
		
        @Html.HiddenFor(model => model.id_Article)
        @Html.HiddenFor(model => model.CreationDate)

        <div class="editor-label">
            @Html.LabelFor(model => model.id_Category)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.id_Category, new SelectList(DataAccess.Article.AvailableCategories, "id_Category", "Description", Model != null ? Model.id_Category : 0))
            @Html.ValidationMessageFor(model => model.id_Category)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.DisplayHome)
        </div>
        <div class="editor-field">
            @Html.CheckBoxFor(model => model.DisplayHome)
            @Html.ValidationMessageFor(model => model.DisplayHome)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Title)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Title)
            @Html.ValidationMessageFor(model => model.Title)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Introduction)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Introduction)
            @Html.ValidationMessageFor(model => model.Introduction)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Content)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Content)
            @Html.ValidationMessageFor(model => model.Content)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Status)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.Status, new SelectList(new StatusTypeList(), "Id", "Name", Model != null && Model.Status != 0 ? Model.Status : (byte)StatusType.Attente))
            @Html.ValidationMessageFor(model => model.Status)
        </div>
        <p class="editor-save">
            <input type="submit" value="Enregistrer" /> |
			@Html.ActionLink("Retour", "Index")
        </p>
    </fieldset>
}

